﻿

Imports System.Data
Imports VSModel
Imports Cls_Common

Partial Class FrontEnd_Control_TinMuaXe_Detail
    Inherits System.Web.UI.UserControl
#Region "Sub and Function "
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            If Not Page.RouteData.Values("Id") Then

                hidID.Value = Page.RouteData.Values("Id")
                ShowData()
            End If
        End If
    End Sub
    Protected Sub ShowData()
        Using data As New VSEntities
            Dim _UserId As Integer = Session("UserId")
            Dim p As TinMuaXe = (From q In data.TinMuaXes Where q.Id = hidID.Value And q.UserId = _UserId Select q).SingleOrDefault
            If Not p Is Nothing Then
                lblMatin.Text = IIf(IsNothing(p.MaTin) = True, "", p.MaTin)
                lblTieude.Text = IIf(IsNothing(p.TieuDe) = True, "", p.TieuDe)
                lblNoidung.Text = IIf(IsNothing(p.NoiDung) = True, "", p.NoiDung)

                lblStatusid.Text = IIf(IsNothing(p.StatusId) = True, "", p.Status.Title)
            
                lblTinmuaxekhoanggiaid.Text = IIf(IsNothing(p.TinMuaXeKhoangGiaId) = True, "", p.TinMuaXeKhoangGia.Title)
            End If
        End Using
    End Sub
#End Region
End Class
